Skip to content

Conversation

pdgendt
Copy link
Contributor

@pdgendt pdgendt commented Sep 15, 2025

Allow setting CONFIG_MCUBOOT_BOOT_MAX_ALIGN to apply a custom programmable block in flash.

Comment on lines 433 to 435
#if defined(CONFIG_MCUBOOT_BOOT_MAX_ALIGN) && CONFIG_MCUBOOT_BOOT_MAX_ALIGN > 0
#define MCUBOOT_BOOT_MAX_ALIGN CONFIG_MCUBOOT_BOOT_MAX_ALIGN
#elif DT_HAS_CHOSEN(zephyr_flash)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have these dt_ macros to use with Kconfig, can we maybe move the entire logic to Kconfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, yes but this fix should make that backwards compatible, no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. So you set the Kconfig to defaults as the logic states here, but people can still override it. Wouldn't that make it backwards compatible?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we also have only one place where it is set: the Kconfig; there would no "if Kconfig is 0 then", because it could only be 0 if we allow somebody to set it as such in Kconfig.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR per your suggestion. A single Kconfig symbol, which default to the chosen flash's write-block-size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side-note, we're backwards compatible like this indeed, but not forwards compatible (which was te case before my change).
So if this change is pulled in without zephyrproject-rtos/zephyr#96001 the behavior changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, a specific commit of MCUboot is valid with a specific commit of zephyr, as the west.yml file points to

Allow setting CONFIG_MCUBOOT_BOOT_MAX_ALIGN to apply a programmable block
in flash. Move the chosen flash write block size logic to Kconfig.

Signed-off-by: Pieter De Gendt <[email protected]>
@nordicjm nordicjm requested a review from de-nordic September 30, 2025 08:49
@de-nordic de-nordic added the area: zephyr Affects the Zephyr port label Sep 30, 2025
@nordicjm nordicjm merged commit cf138a0 into mcu-tools:main Sep 30, 2025
58 checks passed
@pdgendt pdgendt deleted the bootutil-max-align branch September 30, 2025 10:02
@de-nordic
Copy link
Collaborator

@pdgendt We will need release notes entry for this change.

@pdgendt
Copy link
Contributor Author

pdgendt commented Sep 30, 2025

@pdgendt We will need release notes entry for this change.

See #2471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: zephyr Affects the Zephyr port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants